<!--
 * Copyright ©
 * #  
 * @author: zw
 * @date: 2022-03-14 
 -->


<template>
  <div class="login">
    <el-form label-position="top" label-width="80px" :model="formLabelAlign">
      <el-form-item>
        <el-input v-model="formLabelAlign.name" required>
          <span slot="prefix" class="wrap">
            <i class="el-input__icon el-icon-user-solid" />
            <span>名称</span>
          </span>
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-input v-model="formLabelAlign.region" required>
          <span slot="prefix" class="wrap">
            <i class="el-input__icon el-icon-lock" />
            <span>密码</span>
          </span>
        </el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
//  import {} from ''
export default {
  name: 'Login',
  data() {
    return {
      formLabelAlign: {
        name: '',
        region: '',
      },
    };
  },

  mounted() {

  },

  methods: {

  }
  //  End
}

</script>

<style lang='scss' scoped>
.login {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  .el-form {
    position: absolute;
    top: 50%;
    left: 15%;
    width: 400px;
    padding: 40px;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    .el-form-item {
      /deep/ .el-input__inner {
        border: none;
        border-bottom: 1px solid #fff;
        background: transparent;
        // 伪元素的修改 line
        & + .el-input__prefix::before {
          content: "";
          position: absolute;
          display: block;
          bottom: 0%;
          left: 50%;
          width: 0;
          height: 2px;
          background-color: #e21;
          transition: all .8s;
        }
        &:focus + .el-input__prefix::before {
          left: 0;
          width: 100%;
        }
        // label的修改 文本存在时的显示css
        &:focus ~ .el-input__prefix > .wrap, &:valid ~ .el-input__prefix > .wrap {
          position: absolute;
          top: -33px;
          left: 0px;
          color: #fff;
          font-size: 14px;
        }

      }
      /deep/ .el-input__prefix {
        width: 100%;
        text-align: left;
        color: red;
        font-size: 18px;
        left: 0px;
        pointer-events: none;
        & .wrap {
          position: absolute;
          left: 15px;
          transition: .5s ease-in;
        }
      }
    }

  }
}
</style>
